package cn.progen.generator;


import cn.progen.constant.Config;
import cn.progen.model.Table;
import cn.progen.util.FreemarkerUtil;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by wangYuDong on 2017/6/3.
 */
    public class ServiceGenerator extends Generator {
    @Override
    public void out(List<Table> taList) {
        taList.forEach(item->{
            FreemarkerUtil freemarkerUtil=new FreemarkerUtil(Config.Path.getMapperurl(), item.getClassName()+"Mapper.java");
            Map dataMap=new HashMap<>();
            dataMap.put("table", item);
            dataMap.put("basepackage",Config.Path.MAPPERURL);
            dataMap.put("modelpack",Config.Path.MODELURL);
            freemarkerUtil.createDoc(dataMap, "Mapper.java.ftl");
        });
    }
}
